import {
	createApp
} from "vue";
const app = createApp(App);
import router from "./router";
import su from "sudong";

import "@/assets/styles/index"; //注入全部样式
import "@/assets/styles/iconfont/iconfont.css"; //注入全局iconfont图标
import allComponents from "@/components/index";
import {
	request
} from "@/api/http.js";
import tologinState from "@/common/loginState";
import config from "@/common/dsf_config";
import * as echarts from "echarts";

app.use(allComponents); //注入全局组件
app.provide("ajax", request); //请求接口封装-分发全局
app.provide("echarts", echarts); //echart图形可视化-分发全局
app.provide("loginState", tologinState); //判断是否登录-分发全局
app.provide("config", config); //默认配置-分发全局
window.su = su; //全局注入自定义函数（自定义npm包）
// import { store } from '@/common/store/user.js'
import extend from "@/common/extend";
import firsttext from "@/common/plugins/firstText";
import App from "./App.vue";
app.use(router);
app.use(extend); //自定义指令注入
app.use(firsttext); //自定义插件注入
// app.use(store); //自定义插件注入
app.mount("#app");

//markRaw   动态组件
//inject    获取全局分发的内容

// 表单
// const ruleFormRef = ref();
// let form = reactive({
//   userName: "我是东",
// });

//下面是比较常用的代码
// import { ref, reactive, onMounted, inject } from "vue";
// import { ElMessage } from "element-plus";
// const http = inject("ajax");
// import { useRouter } from "vue-router";
// const route = useRouter();
// route.push({ path: d.url });
// onMounted(() => {
//   getData();
// });
// 对象时
// let DState = ref({});
// 数组时
// let state = reactive({
//   arr: [],
// });
// const getData = () => {
//   http("/iaiqsmde9fea569965ed56ab98ea0501752fe631902841e/deptRecommendList", {}, "GET")
//     .then(res => {
//       console.log(res);

//       state.arr = res.data;
//       DState.value = {a:1};
//     })
//     .catch(err => {
//       console.log(err.message || "数据异常");
//     });
// };
// const getImg = d => {
//   return new URL(`../../../assets/imgs/pc/sindex/Department/${d.name}.png`, import.meta.url).href;
// };
// ElMessage("请输入账号");

// 自定义指令
// <button v-clickReTime @click="add">点击{{num}}</button> //防止重复点击
// <div v-upperText="'def'"></div> //全转大写

// 自定义插件
//<div>插件使用{{ $firstText(name) }}</div> 
// const name = ref('xiaoming')
